
const vm = new Vue({
    el: '#app',
    name: 'spiderStock',
    data() {
        return {
            form: {
                username: '',
                password: ''
            },
            rules: {
                username: [
                    { required: true, message: '请输入用户名', trigger: 'blur' }
                ],
                password: [
                    { required: true, message: '请输入密码', trigger: 'blur' },
                    { min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
                ]
            }
        };
    },
    methods: {
        submitForm(formName) {
            var that = this
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    alert('提交成功!');
                     axios.post('/auth/login',that.form)
                                    .then((rs) => {
                                        const result = response.data.code
                                        if (result !== 200) {
                                            debugger
                                            that.$notify.error(response.data.msg)
                                        }else{
                                            that.$notify.success('查询成功')
                                        }

                                    }).catch((e) => {
                                        console.log(e)
                                     })
                } else {
                    console.log('错误提交!!');
                    return false;
                }
            });
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
        }
    }
});